* Replication file for "State-Centric Persistence: Pursuing Social Welfare Benefits in Brazil"
* Rebecca Weitz-Shapiro and Matthew S. Winters
* Governance

**************
* INPUT DATA *
**************

clear all

use "persistence_replication.dta"

**********************
* SUMMARY STATISTICS * 
**********************
 
asdoc sum persistmed_govt entitled indig efficacy male i.ses edu_sevencat white age log_age if par_survey==0 & expect_med!=0, label title(Descriptive Statistics Brazil General Survey) save(summary_stats.doc) replace dec(2)

asdoc sum persistmed_govt entitled indig efficacy male i.ses edu_sevencat white age log_age if par_survey==1 & expect_med!=0, label title(Descriptive Statistics Brazil Parents Survey - Medication Questions) save(summary_stats.doc) append dec(2)

asdoc sum persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses edu_sevencat white age log_age if par_survey==1 & expect1_daycare!=0, label title(Descriptive Statistics Brazil Parents Survey - Daycare Questions) save(summary_stats.doc) append dec(2)

**********************
* MAIN RESULTS TABLE *
**********************

eststo: reg persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==0 & expect_med!=0, robust

eststo: reg persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect_med!=0, robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0, robust

esttab using "MainResultsTable", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample.) label
eststo clear

*** Robustness Check: Logistic Regression Models

eststo: logit persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==0 & expect_med!=0, robust

eststo: logit persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect_med!=0, robust

eststo: logit persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0, robust

esttab using "LogisticModels", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample.) label
eststo clear

*************************************
* MULTINOMIAL LOGIT TABLE AND PLOTS *
*************************************

set printcolor gs1
graph drop _all
eststo clear

* General Survey / Medicine
eststo: mlogit persistmed_threecat_new entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==0 & expect_med != 0, baseoutcome(1) robust

forval k = 0/2 {
margins, at(entitled=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Entitlement") name(entitled) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(indig=(0.00 0.50 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Indignation") name(indig) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(efficacy=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Self-Efficacy") name(efficacy) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

grc1leg2 entitled indig efficacy, ycommon title("General Survey - Medicine") saving("MNL_Brazil_General", replace)

graph drop _all

* Parents Survey / Medicine
eststo: mlogit persistmed_threecat_new entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect_med != 0, baseoutcome(1) robust

forval k = 0/2 {
margins, at(entitled=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Entitlement") name(entitled) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(indig=(0.00 0.50 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Indignation") name(indig) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(efficacy=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Self-Efficacy") name(efficacy) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

grc1leg2 entitled indig efficacy, ycommon title("Brazil Parent Survey - Medicine") saving("MNL_Brazil_Parent_Med", replace)

graph drop _all


* Parents Survey / Daycare
eststo: mlogit persistedu_threecat_new entitled2 indig_edu selfefficacy_edu male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0, baseoutcome(1) robust

forval k = 0/2 {
margins, at(entitled2=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Entitlement") name(entitled) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(indig_edu=(0.00 0.50 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Indignation") name(indig) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

forval k = 0/2 {
margins, at(selfefficacy_edu=(0.00 0.33 0.66 1.00)) predict(outcome(`k')) saving(file`k', replace)
}
combomarginsplot file0 file1 file2, labels("Exit" "Non-State Only" "State") title("") ytitle("") xtitle("Self-Efficacy") name(efficacy) file1opts(msymbol(O)) file2opts(msymbol(D)) file3opts(msymbol(T))

grc1leg2 entitled indig efficacy, ycommon title("Brazil Parent Survey - Daycare") saving("MNL_Brazil_Parent_Edu", replace)

graph drop _all

* Combined Plot
 
grc1leg2 MNL_Brazil_General.gph MNL_Brazil_Parent_Med.gph MNL_Brazil_Parent_Edu.gph, altshrink cols(2) ysize(6) xsize(4) title("Predicted Probabilities") saving("MNLs_CombinedPlot", replace)

graph export MNLs_CombinedPlot.pdf, replace

* Table
esttab using "MultinomialLogitAnalyses_BaseCatOther", ///
csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Multinomial logistic regression models with three-category outcome variable. Taking other forms of actions is the base category.) label
eststo clear


*******************
* APPENDIX TABLES *
*******************

*** Cross-Tabs of State-Centric Persistence and Expectations of the State

asdoc tab persistmed_govt expect_med if par_survey==0, col save(scp-expect-crosstab1.doc)
asdoc tab persistmed_govt expect_med if par_survey==1, col save(scp-expect-crosstab1.doc) append
asdoc tab persistedu_govt expect1_daycare if par_survey==1, col save(scp-expect-crosstab1.doc) append

*** Cross-Tabs of 2ei and Social Classes

asdoc tab sel entitled if par_survey==0, row save(class_crosstabs.doc)
asdoc tab sel indig if par_survey==0, row save(class_crosstabs.doc) append
asdoc tab sel efficacy if par_survey==0, row save(class_crosstabs.doc) append
asdoc tab sel entitled if par_survey==1, row save(class_crosstabs.doc)
asdoc tab sel indig if par_survey==1, row save(class_crosstabs.doc) append
asdoc tab sel efficacy if par_survey==1, row save(class_crosstabs.doc) append
asdoc tab sel entitled2 if par_survey==1, row save(class_crosstabs.doc)
asdoc tab sel indig_edu if par_survey==1, row save(class_crosstabs.doc) append
asdoc tab sel selfefficacy_edu if par_survey==1, row save(class_crosstabs.doc) append

ttest entitled if inlist(sel, 4, 5) & par_survey==0, by(sel)
ttest entitled if inlist(sel, 4, 6) & par_survey==0, by(sel)
ttest entitled if inlist(sel, 5, 6) & par_survey==0, by(sel)

ttest entitled if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest entitled if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest entitled if inlist(sel, 5, 6) & par_survey==1, by(sel)

ttest entitled2 if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest entitled2 if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest entitled2 if inlist(sel, 5, 6) & par_survey==1, by(sel)

ttest indig if inlist(sel, 4, 5) & par_survey==0, by(sel)
ttest indig if inlist(sel, 4, 6) & par_survey==0, by(sel)
ttest indig if inlist(sel, 5, 6) & par_survey==0, by(sel)

ttest indig if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest indig if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest indig if inlist(sel, 5, 6) & par_survey==1, by(sel)

ttest indig_edu if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest indig_edu if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest indig_edu if inlist(sel, 5, 6) & par_survey==1, by(sel)

ttest efficacy if inlist(sel, 4, 5) & par_survey==0, by(sel)
ttest efficacy if inlist(sel, 4, 6) & par_survey==0, by(sel)
ttest efficacy if inlist(sel, 5, 6) & par_survey==0, by(sel)

ttest efficacy if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest efficacy if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest efficacy if inlist(sel, 5, 6) & par_survey==1, by(sel)

ttest selfefficacy_edu if inlist(sel, 4, 5) & par_survey==1, by(sel)
ttest selfefficacy_edu if inlist(sel, 4, 6) & par_survey==1, by(sel)
ttest selfefficacy_edu if inlist(sel, 5, 6) & par_survey==1, by(sel)

*** Statistics about the Self-Efficacy Indices

* General - Medication 
alpha q42 q43 q47 q48 if par_survey==0
pca q42 q43 q47 q48

* Parent - Medication
alpha q52 q53 q57 q58 if par_survey==1
pca q52 q53 q57 q58

* Parent - Education
alpha q41 q42 q47 q48 if par_survey==1
pca q41 q42 q47 q48

*** Results Including All Respondents 

eststo: reg persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==0, robust

eststo: reg persistmed_govt entitled indig efficacy male i.ses edu_sevencat white log_age i.region if par_survey==1, robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses edu_sevencat white log_age i.region if par_survey==1, robust

esttab using "ResultsTable_AllRespondents", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey.) label
eststo clear

*** Subgroup Analyses by Education and Class

* Classes C2/D/E

eststo: reg persistmed_govt entitled indig efficacy male edu_sevencat white log_age i.region if par_survey==0 & expect_med!=0 & ses < 2, robust

eststo: reg persistmed_govt entitled indig efficacy male edu_sevencat white log_age i.region if par_survey==1 & expect_med!=0 & ses < 2, robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0 & ses < 2, robust

esttab using "ResultsTable_ClassesC2DE", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample.  Classes C2/D/E only.) label
eststo clear

* Class C1

eststo: reg persistmed_govt entitled indig efficacy male edu_sevencat white log_age i.region if par_survey==0 & expect_med!=0 & ses==2, robust

eststo: reg persistmed_govt entitled indig efficacy male edu_sevencat white log_age i.region if par_survey==1 & expect_med!=0 & ses==2, robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0 & ses==2, robust

esttab using "ResultsTable_ClassC1", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample.  Classes C2/D/E only.) label
eststo clear

* Completed Secondary or Less

eststo: reg persistmed_govt entitled indig efficacy male i.ses white log_age i.region if par_survey==0 & expect_med!=0 & edu_sevencat < 0.7, robust

eststo: reg persistmed_govt entitled indig efficacy male i.ses white log_age i.region if par_survey==1 & expect_med!=0 & edu_sevencat < 0.7, robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses white log_age i.region if par_survey==1 & expect1_daycare!=0 & edu_sevencat < 0.7, robust

esttab using "ResultsTable_CompleteSecondaryOrLess", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence. (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample. Respondents with completed secondary education or less only.) label
eststo clear

* Some University

eststo: reg persistmed_govt entitled indig efficacy male i.ses white log_age i.region if par_survey==0 & expect_med!=0 & edu_sevencat > 0.7 & edu_sevencat!=., robust

eststo: reg persistmed_govt entitled indig efficacy male i.ses white log_age i.region if par_survey==1 & expect_med!=0 & edu_sevencat > 0.7 & edu_sevencat!=., robust

eststo: reg persistedu_govt entitled2 indig_edu selfefficacy_edu male i.ses white log_age i.region if par_survey==1 & expect1_daycare!=0 & edu_sevencat > 0.7 & edu_sevencat!=., robust

esttab using "ResultsTable_SomeUniversity", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig indig_edu efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence. (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample. Respondents with at least some university education.) label
eststo clear

*** Alternative Operationalization of Indignation
 
eststo: reg persistmed_govt entitled indig_alt efficacy male i.ses edu_sevencat white log_age i.region if par_survey==0 & expect_med!=0, robust

eststo: reg persistmed_govt entitled indig_alt efficacy male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect_med!=0, robust

eststo: reg persistedu_govt entitled2 indig_edu_alt selfefficacy_edu male i.ses edu_sevencat white log_age i.region if par_survey==1 & expect1_daycare!=0, robust

esttab using "ResultsTable_AltIndignation", ///
 csv replace se ar2 b(a2) nobaselevels star(* 0.10 ** 0.05 *** 0.01) order (entitled entitled2 indig_alt indig_edu_alt efficacy selfefficacy_edu) addnotes(Linear probability models with robust standard errors in parentheses.  DV: state-centric persistence.  Education is recoded as a seven-category variable.  (1) is Brazil general survey; (2) is medicine in Brazil parent survey; (3) is daycare in Brazil parent survey. Respondents who give the lowest response on the expectations variable are eliminated from the estimation sample.) label
eststo clear






*** END OF FILE ***
